home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / Sound.a < prev    next >
Text File  |  1996-05-01  |  30KB  |  989 lines

  1. ;
  2. ;    File:        Sound.a
  3. ;
  4. ;    Contains:    Sound Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    Sound Manager 3.1
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__SOUND__') = 'UNDEFINED' THEN
  19. __SOUND__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  25.     include 'Components.a'
  26.     ENDIF
  27.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  28.     include 'MixedMode.a'
  29.     ENDIF
  30.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  31. ;
  32. ;                        * * *  N O T E  * * *
  33. ;
  34. ;    This file has been updated to include Sound Manager 3.2 interfaces.
  35. ;
  36. ;    Some of the Sound Manager 3.0 interfaces were not put into the InterfaceLib
  37. ;    that originally shipped with the PowerMacs. These missing functions and the
  38. ;    new 3.2 interfaces have been released in the SoundLib library for PowerPC
  39. ;    developers to link with. The runtime library for these functions are
  40. ;    installed by Sound Manager 3.2. The following functions are found in SoundLib.
  41. ;
  42. ;        GetCompressionInfo(), GetSoundPreference(), SetSoundPreference(),
  43. ;        UnsignedFixedMulDiv(), SndGetInfo(), SndSetInfo(), GetSoundOutputInfo(),
  44. ;        SetSoundOutputInfo(), GetCompressionName(), SoundConverterOpen(),
  45. ;        SoundConverterClose(), SoundConverterGetBufferSizes(), SoundConverterBeginConversion(),
  46. ;        SoundConverterConvertBuffer(), SoundConverterEndConversion()
  47. ;
  48. ;
  49. ;    Interfaces for Sound Driver, !!! OBSOLETE and NOT SUPPORTED !!!
  50. ;
  51. ;    These items are no longer defined, but appear here so that someone
  52. ;    searching the interfaces might find them. If you are using one of these
  53. ;    items, you must change your code to support the Sound Manager.
  54. ;
  55. ;        swMode, ftMode, ffMode
  56. ;        FreeWave, FFSynthRec, Tone, SWSynthRec, Wave, FTSoundRec
  57. ;        SndCompletionProcPtr
  58. ;        StartSound, StopSound, SoundDone
  59. ;
  60.  
  61. soundListRsrc                    EQU        'snd '                ;Resource type used by Sound Manager
  62. rate44khz                        EQU        $AC440000            ;44100.00000 in fixed-point
  63. rate22050hz                        EQU        $56220000            ;22050.00000 in fixed-point
  64. rate22khz                        EQU        $56EE8BA3            ;22254.54545 in fixed-point
  65. rate11khz                        EQU        $2B7745D1            ;11127.27273 in fixed-point
  66. rate11025hz                        EQU        $2B110000            ;11025.00000 in fixed-point
  67.                                                             ;synthesizer numbers for SndNewChannel
  68. squareWaveSynth                    EQU        1                    ;square wave synthesizer
  69. waveTableSynth                    EQU        3                    ;wave table synthesizer
  70. sampledSynth                    EQU        5                    ;sampled sound synthesizer
  71.                                                             ;old Sound Manager MACE synthesizer numbers
  72. MACE3snthID                        EQU        11
  73. MACE6snthID                        EQU        13
  74. kMiddleC                        EQU        60                    ;MIDI note value for middle C
  75. kSimpleBeepID                    EQU        1                    ;reserved resource ID for Simple Beep
  76. kFullVolume                        EQU        $0100                ;1.0, setting for full hardware output volume
  77. kNoVolume                        EQU        0                    ;setting for no sound volume
  78.                                                             ;command numbers for SndDoCommand and SndDoImmediate
  79. nullCmd                            EQU        0
  80. initCmd                            EQU        1
  81. freeCmd                            EQU        2
  82. quietCmd                        EQU        3
  83. flushCmd                        EQU        4
  84. reInitCmd                        EQU        5
  85. waitCmd                            EQU        10
  86. pauseCmd                        EQU        11
  87. resumeCmd                        EQU        12
  88. callBackCmd                        EQU        13
  89.  
  90. syncCmd                            EQU        14
  91. availableCmd                    EQU        24
  92. versionCmd                        EQU        25
  93. totalLoadCmd                    EQU        26
  94. loadCmd                            EQU        27
  95. freqDurationCmd                    EQU        40
  96. restCmd                            EQU        41
  97. freqCmd                            EQU        42
  98. ampCmd                            EQU        43
  99. timbreCmd                        EQU        44
  100. getAmpCmd                        EQU        45
  101. volumeCmd                        EQU        46                    ;sound manager 3.0 or later only
  102. getVolumeCmd                    EQU        47                    ;sound manager 3.0 or later only
  103. waveTableCmd                    EQU        60
  104. phaseCmd                        EQU        61
  105.  
  106. soundCmd                        EQU        80
  107. bufferCmd                        EQU        81
  108. rateCmd                            EQU        82
  109. continueCmd                        EQU        83
  110. doubleBufferCmd                    EQU        84
  111. getRateCmd                        EQU        85
  112. rateMultiplierCmd                EQU        86
  113. getRateMultiplierCmd            EQU        87
  114. sizeCmd                            EQU        90                    ;obsolete command
  115. convertCmd                        EQU        91                    ;obsolete MACE command
  116. stdQLength                        EQU        128
  117. dataOffsetFlag                    EQU        $8000
  118. ; channel initialization parameters
  119.     IF OLDROUTINENAMES THEN
  120.  
  121. waveInitChannelMask                EQU        $07
  122. waveInitChannel0                EQU        $04                    ;wave table only, Sound Manager 2.0 and earlier
  123. waveInitChannel1                EQU        $05                    ;wave table only, Sound Manager 2.0 and earlier
  124. waveInitChannel2                EQU        $06                    ;wave table only, Sound Manager 2.0 and earlier
  125. waveInitChannel3                EQU        $07                    ;wave table only, Sound Manager 2.0 and earlier
  126. initChan0                        EQU        $04                    ;obsolete spelling
  127. initChan1                        EQU        $05                    ;obsolete spelling
  128. initChan2                        EQU        $06                    ;obsolete spelling
  129. initChan3                        EQU        $07                    ;obsolete spelling
  130.     ENDIF
  131.  
  132. initChanLeft                    EQU        $0002                ;left stereo channel
  133. initChanRight                    EQU        $0003                ;right stereo channel
  134. initNoInterp                    EQU        $0004                ;no linear interpolation
  135. initNoDrop                        EQU        $0008                ;no drop-sample conversion
  136. initMono                        EQU        $0080                ;monophonic channel
  137. initStereo                        EQU        $00C0                ;stereo channel
  138. initMACE3                        EQU        $0300                ;MACE 3:1
  139. initMACE6                        EQU        $0400                ;MACE 6:1
  140. initPanMask                        EQU        $0003                ;mask for right/left pan values
  141. initSRateMask                    EQU        $0030                ;mask for sample rate values
  142. initStereoMask                    EQU        $00C0                ;mask for mono/stereo values
  143. initCompMask                    EQU        $FF00                ;mask for compression IDs
  144. kUseOptionalOutputDevice        EQU        -1                    ;only for Sound Manager 3.0 or later
  145. notCompressed                    EQU        0                    ;compression ID's
  146. fixedCompression                EQU        -1                    ;compression ID for fixed-sized compression
  147. variableCompression                EQU        -2                    ;compression ID for variable-sized compression
  148. twoToOne                        EQU        1
  149. eightToThree                    EQU        2
  150. threeToOne                        EQU        3
  151. sixToOne                        EQU        4
  152.     IF ¨ GENERATINGPOWERPC THEN
  153.  
  154. stdSH                            EQU        $00                    ;Standard sound header encode value
  155. extSH                            EQU        $FF                    ;Extended sound header encode value
  156. cmpSH                            EQU        $FE                    ;Compressed sound header encode value
  157.     ENDIF
  158.  
  159. outsideCmpSH                    EQU        0                    ;obsolete MACE constant
  160. insideCmpSH                        EQU        1                    ;obsolete MACE constant
  161. aceSuccess                        EQU        0                    ;obsolete MACE constant
  162. aceMemFull                        EQU        1                    ;obsolete MACE constant
  163. aceNilBlock                        EQU        2                    ;obsolete MACE constant
  164. aceBadComp                        EQU        3                    ;obsolete MACE constant
  165. aceBadEncode                    EQU        4                    ;obsolete MACE constant
  166. aceBadDest                        EQU        5                    ;obsolete MACE constant
  167. aceBadCmd                        EQU        6                    ;obsolete MACE constant
  168. sixToOnePacketSize                EQU        8
  169. threeToOnePacketSize            EQU        16
  170. stateBlockSize                    EQU        64
  171. leftOverBlockSize                EQU        32
  172. firstSoundFormat                EQU        $0001                ;general sound format
  173. secondSoundFormat                EQU        $0002                ;special sampled sound format (HyperCard)
  174. dbBufferReady                    EQU        $00000001            ;double buffer is filled
  175. dbLastBuffer                    EQU        $00000004            ;last double buffer to play
  176. sysBeepDisable                    EQU        $0000                ;SysBeep() enable flags
  177. sysBeepEnable                    EQU        $01
  178. sysBeepSynchronous                EQU        $02                    ;if bit set, make alert sounds synchronous
  179. unitTypeNoSelection                EQU        $FFFF                ;unitTypes for AudioSelection.unitType
  180. unitTypeSeconds                    EQU        $0000
  181. ; unsigned fixed-point number
  182. ; typedef unsigned long                 UnsignedFixed
  183.  
  184. SndCommand                RECORD 0
  185. cmd                         ds.w    1                ; offset: $0 (0)
  186. param1                     ds.w    1                ; offset: $2 (2)
  187. param2                     ds.l    1                ; offset: $4 (4)
  188. sizeof                     EQU *                    ; size:   $8 (8)
  189.                         ENDR
  190.  
  191.  
  192. ; typedef SndChannel *                    SndChannelPtr
  193.  
  194. SndChannel                RECORD 0
  195. nextChan                 ds.l    1                ; offset: $0 (0)
  196. firstMod                 ds.l    1                ; offset: $4 (4)        ;  reserved for the Sound Manager 
  197. callBack                 ds.l    1                ; offset: $8 (8)
  198. userInfo                 ds.l    1                ; offset: $C (12)
  199. wait                     ds.l    1                ; offset: $10 (16)        ;  The following is for internal Sound Manager use only.
  200. cmdInProgress             ds        SndCommand        ; offset: $14 (20)
  201. flags                     ds.w    1                ; offset: $1C (28)
  202. qLength                     ds.w    1                ; offset: $1E (30)
  203. qHead                     ds.w    1                ; offset: $20 (32)
  204. qTail                     ds.w    1                ; offset: $22 (34)
  205. queue                     ds.b    128 * SndCommand.sizeof ; offset: $24 (36)
  206. sizeof                     EQU *                    ; size:   $424 (1060)
  207.                         ENDR
  208. ; MACE structures
  209. StateBlock                RECORD 0
  210. stateVar                 ds.w    64                ; offset: $0 (0)
  211. sizeof                     EQU *                    ; size:   $80 (128)
  212.                         ENDR
  213. ; typedef struct StateBlock *            StateBlockPtr
  214.  
  215. LeftOverBlock            RECORD 0
  216. count                     ds.l    1                ; offset: $0 (0)
  217. sampleArea                 ds.b    32                ; offset: $4 (4)
  218. sizeof                     EQU *                    ; size:   $24 (36)
  219.                         ENDR
  220. ; typedef struct LeftOverBlock *        LeftOverBlockPtr
  221.  
  222. ModRef                    RECORD 0
  223. modNumber                 ds.w    1                ; offset: $0 (0)
  224. modInit                     ds.l    1                ; offset: $2 (2)
  225. sizeof                     EQU *                    ; size:   $6 (6)
  226.                         ENDR
  227. SndListResource            RECORD 0
  228. format                     ds.w    1                ; offset: $0 (0)
  229. numModifiers             ds.w    1                ; offset: $2 (2)
  230. modifierPart             ds        ModRef            ; offset: $4 (4) <-- really an array of length one
  231. numCommands                 ds.w    1                ; offset: $A (10)
  232. commandPart                 ds        SndCommand        ; offset: $C (12) <-- really an array of length one
  233. dataPart                 ds.b    1                ; offset: $14 (20) <-- really an array of length one
  234.                          ORG 22
  235. sizeof                     EQU *                    ; size:   $16 (22)
  236.                         ENDR
  237. ; typedef struct SndListResource *        SndListPtr
  238.  
  239. ; typedef SndListPtr *                    SndListHndl
  240.  
  241. ; typedef SndListPtr *                    SndListHandle
  242.  
  243. ; HyperCard sound resource format
  244. Snd2ListResource        RECORD 0
  245. format                     ds.w    1                ; offset: $0 (0)
  246. refCount                 ds.w    1                ; offset: $2 (2)
  247. numCommands                 ds.w    1                ; offset: $4 (4)
  248. commandPart                 ds        SndCommand        ; offset: $6 (6) <-- really an array of length one
  249. dataPart                 ds.b    1                ; offset: $E (14) <-- really an array of length one
  250.                          ORG 16
  251. sizeof                     EQU *                    ; size:   $10 (16)
  252.                         ENDR
  253. ; typedef struct Snd2ListResource *        Snd2ListPtr
  254.  
  255. ; typedef Snd2ListPtr *                    Snd2ListHndl
  256.  
  257. ; typedef Snd2ListPtr *                    Snd2ListHandle
  258.  
  259. SoundHeader                RECORD 0
  260. samplePtr                 ds.l    1                ; offset: $0 (0)        ; if NIL then samples are in sampleArea
  261. length                     ds.l    1                ; offset: $4 (4)        ; length of sound in bytes
  262. sampleRate                 ds.l    1                ; offset: $8 (8)        ; sample rate for this sound
  263. loopStart                 ds.l    1                ; offset: $C (12)        ; start of looping portion
  264. loopEnd                     ds.l    1                ; offset: $10 (16)        ; end of looping portion
  265. encode                     ds.b    1                ; offset: $14 (20)        ; header encoding
  266. baseFrequency             ds.b    1                ; offset: $15 (21)        ; baseFrequency value
  267. sampleArea                 ds.b    1                ; offset: $16 (22) <-- really an array of length one ; space for when samples follow directly
  268.                          ORG 24
  269. sizeof                     EQU *                    ; size:   $18 (24)
  270.                         ENDR
  271. ; typedef struct SoundHeader *            SoundHeaderPtr
  272.  
  273. CmpSoundHeader            RECORD 0
  274. samplePtr                 ds.l    1                ; offset: $0 (0)        ; if nil then samples are in sample area
  275. numChannels                 ds.l    1                ; offset: $4 (4)        ; number of channels i.e. mono = 1
  276. sampleRate                 ds.l    1                ; offset: $8 (8)        ; sample rate in Apples Fixed point representation
  277. loopStart                 ds.l    1                ; offset: $C (12)        ; loopStart of sound before compression
  278. loopEnd                     ds.l    1                ; offset: $10 (16)        ; loopEnd of sound before compression
  279. encode                     ds.b    1                ; offset: $14 (20)        ; data structure used , stdSH, extSH, or cmpSH
  280. baseFrequency             ds.b    1                ; offset: $15 (21)        ; same meaning as regular SoundHeader
  281. numFrames                 ds.l    1                ; offset: $16 (22)        ; length in frames ( packetFrames or sampleFrames )
  282. AIFFSampleRate             ds        extended80        ; offset: $1A (26)        ; IEEE sample rate
  283. markerChunk                 ds.l    1                ; offset: $24 (36)        ; sync track
  284. format                     ds.l    1                ; offset: $28 (40)        ; data format type, was futureUse1
  285. futureUse2                 ds.l    1                ; offset: $2C (44)        ; reserved by Apple
  286. stateVars                 ds.l    1                ; offset: $30 (48)        ; pointer to State Block
  287. leftOverSamples             ds.l    1                ; offset: $34 (52)        ; used to save truncated samples between compression calls
  288. compressionID             ds.w    1                ; offset: $38 (56)        ; 0 means no compression, non zero means compressionID
  289. packetSize                 ds.w    1                ; offset: $3A (58)        ; number of bits in compressed sample packet
  290. snthID                     ds.w    1                ; offset: $3C (60)        ; resource ID of Sound Manager snth that contains NRT C/E
  291. sampleSize                 ds.w    1                ; offset: $3E (62)        ; number of bits in non-compressed sample
  292. sampleArea                 ds.b    1                ; offset: $40 (64) <-- really an array of length one ; space for when samples follow directly
  293.                          ORG 66
  294. sizeof                     EQU *                    ; size:   $42 (66)
  295.                         ENDR
  296. ; typedef struct CmpSoundHeader *        CmpSoundHeaderPtr
  297.  
  298. ExtSoundHeader            RECORD 0
  299. samplePtr                 ds.l    1                ; offset: $0 (0)        ; if nil then samples are in sample area
  300. numChannels                 ds.l    1                ; offset: $4 (4)        ; number of channels,  ie mono = 1
  301. sampleRate                 ds.l    1                ; offset: $8 (8)        ; sample rate in Apples Fixed point representation
  302. loopStart                 ds.l    1                ; offset: $C (12)        ; same meaning as regular SoundHeader
  303. loopEnd                     ds.l    1                ; offset: $10 (16)        ; same meaning as regular SoundHeader
  304. encode                     ds.b    1                ; offset: $14 (20)        ; data structure used , stdSH, extSH, or cmpSH
  305. baseFrequency             ds.b    1                ; offset: $15 (21)        ; same meaning as regular SoundHeader
  306. numFrames                 ds.l    1                ; offset: $16 (22)        ; length in total number of frames
  307. AIFFSampleRate             ds        extended80        ; offset: $1A (26)        ; IEEE sample rate
  308. markerChunk                 ds.l    1                ; offset: $24 (36)        ; sync track
  309. instrumentChunks         ds.l    1                ; offset: $28 (40)        ; AIFF instrument chunks
  310. AESRecording             ds.l    1                ; offset: $2C (44)
  311. sampleSize                 ds.w    1                ; offset: $30 (48)        ; number of bits in sample
  312. futureUse1                 ds.w    1                ; offset: $32 (50)        ; reserved by Apple
  313. futureUse2                 ds.l    1                ; offset: $34 (52)        ; reserved by Apple
  314. futureUse3                 ds.l    1                ; offset: $38 (56)        ; reserved by Apple
  315. futureUse4                 ds.l    1                ; offset: $3C (60)        ; reserved by Apple
  316. sampleArea                 ds.b    1                ; offset: $40 (64) <-- really an array of length one ; space for when samples follow directly
  317.                          ORG 66
  318. sizeof                     EQU *                    ; size:   $42 (66)
  319.                         ENDR
  320. ; typedef struct ExtSoundHeader *        ExtSoundHeaderPtr
  321.  
  322. ConversionBlock            RECORD 0
  323. destination                 ds.w    1                ; offset: $0 (0)
  324. unused                     ds.w    1                ; offset: $2 (2)
  325. inputPtr                 ds.l    1                ; offset: $4 (4)
  326. outputPtr                 ds.l    1                ; offset: $8 (8)
  327. sizeof                     EQU *                    ; size:   $C (12)
  328.                         ENDR
  329. ; typedef struct ConversionBlock *        ConversionBlockPtr
  330.  
  331. SMStatus                RECORD 0
  332. smMaxCPULoad             ds.w    1                ; offset: $0 (0)
  333. smNumChannels             ds.w    1                ; offset: $2 (2)
  334. smCurCPULoad             ds.w    1                ; offset: $4 (4)
  335. sizeof                     EQU *                    ; size:   $6 (6)
  336.                         ENDR
  337. ; typedef struct SMStatus *                SMStatusPtr
  338.  
  339. SCStatus                RECORD 0
  340. scStartTime                 ds.l    1                ; offset: $0 (0)
  341. scEndTime                 ds.l    1                ; offset: $4 (4)
  342. scCurrentTime             ds.l    1                ; offset: $8 (8)
  343. scChannelBusy             ds.b    1                ; offset: $C (12)
  344. scChannelDisposed         ds.b    1                ; offset: $D (13)
  345. scChannelPaused             ds.b    1                ; offset: $E (14)
  346. scUnused                 ds.b    1                ; offset: $F (15)
  347. scChannelAttributes         ds.l    1                ; offset: $10 (16)
  348. scCPULoad                 ds.l    1                ; offset: $14 (20)
  349. sizeof                     EQU *                    ; size:   $18 (24)
  350.                         ENDR
  351. ; typedef struct SCStatus *                SCStatusPtr
  352.  
  353. AudioSelection            RECORD 0
  354. unitType                 ds.l    1                ; offset: $0 (0)
  355. selStart                 ds.l    1                ; offset: $4 (4)
  356. selEnd                     ds.l    1                ; offset: $8 (8)
  357. sizeof                     EQU *                    ; size:   $C (12)
  358.                         ENDR
  359. ; typedef struct AudioSelection *        AudioSelectionPtr
  360.  
  361. SndDoubleBuffer            RECORD 0
  362. dbNumFrames                 ds.l    1                ; offset: $0 (0)
  363. dbFlags                     ds.l    1                ; offset: $4 (4)
  364. dbUserInfo                 ds.l    2                ; offset: $8 (8)
  365. dbSoundData                 ds.b    1                ; offset: $10 (16) <-- really an array of length one
  366.                          ORG 18
  367. sizeof                     EQU *                    ; size:   $12 (18)
  368.                         ENDR
  369. ; typedef struct SndDoubleBuffer *        SndDoubleBufferPtr
  370.  
  371. SndDoubleBufferHeader    RECORD 0
  372. dbhNumChannels             ds.w    1                ; offset: $0 (0)
  373. dbhSampleSize             ds.w    1                ; offset: $2 (2)
  374. dbhCompressionID         ds.w    1                ; offset: $4 (4)
  375. dbhPacketSize             ds.w    1                ; offset: $6 (6)
  376. dbhSampleRate             ds.l    1                ; offset: $8 (8)
  377. dbhBufferPtr             ds.l    2                ; offset: $C (12)
  378. dbhDoubleBack             ds.l    1                ; offset: $14 (20)
  379. sizeof                     EQU *                    ; size:   $18 (24)
  380.                         ENDR
  381. ; typedef struct SndDoubleBufferHeader * SndDoubleBufferHeaderPtr
  382.  
  383. SndDoubleBufferHeader2    RECORD 0
  384. dbhNumChannels             ds.w    1                ; offset: $0 (0)
  385. dbhSampleSize             ds.w    1                ; offset: $2 (2)
  386. dbhCompressionID         ds.w    1                ; offset: $4 (4)
  387. dbhPacketSize             ds.w    1                ; offset: $6 (6)
  388. dbhSampleRate             ds.l    1                ; offset: $8 (8)
  389. dbhBufferPtr             ds.l    2                ; offset: $C (12)
  390. dbhDoubleBack             ds.l    1                ; offset: $14 (20)
  391. dbhFormat                 ds.l    1                ; offset: $18 (24)
  392. sizeof                     EQU *                    ; size:   $1C (28)
  393.                         ENDR
  394. ; typedef struct SndDoubleBufferHeader2 * SndDoubleBufferHeader2Ptr
  395.  
  396. SoundInfoList            RECORD 0
  397. count                     ds.w    1                ; offset: $0 (0)
  398. infoHandle                 ds.l    1                ; offset: $2 (2)
  399. sizeof                     EQU *                    ; size:   $6 (6)
  400.                         ENDR
  401. ; typedef struct SoundInfoList *        SoundInfoListPtr
  402.  
  403. SoundComponentData        RECORD 0
  404. flags                     ds.l    1                ; offset: $0 (0)
  405. format                     ds.l    1                ; offset: $4 (4)
  406. numChannels                 ds.w    1                ; offset: $8 (8)
  407. sampleSize                 ds.w    1                ; offset: $A (10)
  408. sampleRate                 ds.l    1                ; offset: $C (12)
  409. sampleCount                 ds.l    1                ; offset: $10 (16)
  410. buffer                     ds.l    1                ; offset: $14 (20)
  411. reserved                 ds.l    1                ; offset: $18 (24)
  412. sizeof                     EQU *                    ; size:   $1C (28)
  413.                         ENDR
  414. ; typedef struct SoundComponentData *    SoundComponentDataPtr
  415.  
  416. CompressionInfo            RECORD 0
  417. recordSize                 ds.l    1                ; offset: $0 (0)
  418. format                     ds.l    1                ; offset: $4 (4)
  419. compressionID             ds.w    1                ; offset: $8 (8)
  420. samplesPerPacket         ds.w    1                ; offset: $A (10)
  421. bytesPerPacket             ds.w    1                ; offset: $C (12)
  422. bytesPerFrame             ds.w    1                ; offset: $E (14)
  423. bytesPerSample             ds.w    1                ; offset: $10 (16)
  424. futureUse1                 ds.w    1                ; offset: $12 (18)
  425. sizeof                     EQU *                    ; size:   $14 (20)
  426.                         ENDR
  427. ; typedef struct CompressionInfo *        CompressionInfoPtr
  428.  
  429. ; typedef CompressionInfoPtr *            CompressionInfoHandle
  430.  
  431. ; private thing to use as a reference to a Sound Converter
  432.  
  433.  
  434.     IF FOR_SYSTEM7_ONLY THEN
  435. ;
  436. ; These two routines for Get/SetSoundVol should no longer be used.
  437. ; They were for old Apple Sound Chip machines, and do not support the DSP or PowerMacs.
  438. ; Use Get/SetDefaultOutputVolume instead, if you must change the user's machine.
  439. ;
  440.     IF OLDROUTINENAMES ** ¨ GENERATINGCFM THEN
  441. ;
  442. ; pascal void SetSoundVol(short level)
  443. ;
  444.     IF GENERATINGCFM THEN
  445.         IMPORT_CFM_FUNCTION SetSoundVol
  446.     ENDIF
  447.  
  448. ;
  449. ; pascal void GetSoundVol(short *level)
  450. ;
  451.     IF ¨ GENERATINGCFM THEN
  452.         ; parameters:
  453.         ;    level           => A0
  454.         Macro
  455.         _GetSoundVol
  456.             clr.b               (A0)+
  457.             move.b              $0260,(A0)
  458.         EndM
  459.     ELSE
  460.         IMPORT_CFM_FUNCTION GetSoundVol
  461.     ENDIF
  462.  
  463.     ENDIF
  464.     ENDIF
  465. ;
  466. ; pascal void SysBeep(short duration)
  467. ;
  468.     IF ¨ GENERATINGCFM THEN
  469.         _SysBeep:    OPWORD    $A9C8
  470.     ELSE
  471.         IMPORT_CFM_FUNCTION SysBeep
  472.     ENDIF
  473.  
  474. ;
  475. ; pascal OSErr SndDoCommand(SndChannelPtr chan, const SndCommand *cmd, Boolean noWait)
  476. ;
  477.     IF ¨ GENERATINGCFM THEN
  478.         _SndDoCommand:    OPWORD    $A803
  479.     ELSE
  480.         IMPORT_CFM_FUNCTION SndDoCommand
  481.     ENDIF
  482.  
  483. ;
  484. ; pascal OSErr SndDoImmediate(SndChannelPtr chan, const SndCommand *cmd)
  485. ;
  486.     IF ¨ GENERATINGCFM THEN
  487.         _SndDoImmediate:    OPWORD    $A804
  488.     ELSE
  489.         IMPORT_CFM_FUNCTION SndDoImmediate
  490.     ENDIF
  491.  
  492. ;
  493. ; pascal OSErr SndNewChannel(SndChannelPtr *chan, short synth, long init, SndCallBackUPP userRoutine)
  494. ;
  495.     IF ¨ GENERATINGCFM THEN
  496.         _SndNewChannel:    OPWORD    $A807
  497.     ELSE
  498.         IMPORT_CFM_FUNCTION SndNewChannel
  499.     ENDIF
  500.  
  501. ;
  502. ; pascal OSErr SndDisposeChannel(SndChannelPtr chan, Boolean quietNow)
  503. ;
  504.     IF ¨ GENERATINGCFM THEN
  505.         _SndDisposeChannel:    OPWORD    $A801
  506.     ELSE
  507.         IMPORT_CFM_FUNCTION SndDisposeChannel
  508.     ENDIF
  509.  
  510. ;
  511. ; pascal OSErr SndPlay(SndChannelPtr chan, SndListHandle sndHandle, Boolean async)
  512. ;
  513.     IF ¨ GENERATINGCFM THEN
  514.         _SndPlay:    OPWORD    $A805
  515.     ELSE
  516.         IMPORT_CFM_FUNCTION SndPlay
  517.     ENDIF
  518.  
  519.     IF OLDROUTINENAMES THEN
  520. ;
  521. ; pascal OSErr SndAddModifier(SndChannelPtr chan, Ptr modifier, short id, long init)
  522. ;
  523.     IF ¨ GENERATINGCFM THEN
  524.         _SndAddModifier:    OPWORD    $A802
  525.     ELSE
  526.         IMPORT_CFM_FUNCTION SndAddModifier
  527.     ENDIF
  528.  
  529.     ENDIF
  530. ;
  531. ; pascal OSErr SndControl(short id, SndCommand *cmd)
  532. ;
  533.     IF ¨ GENERATINGCFM THEN
  534.         _SndControl:    OPWORD    $A806
  535.     ELSE
  536.         IMPORT_CFM_FUNCTION SndControl
  537.     ENDIF
  538.  
  539. ;  Sound Manager 2.0 and later, uses _SoundDispatch 
  540. ;
  541. ; pascal NumVersion SndSoundManagerVersion(void )
  542. ;
  543.     IF ¨ GENERATINGCFM THEN
  544.         Macro
  545.         _SndSoundManagerVersion
  546.             move.l              #$000C0008,D0
  547.             dc.w                $A800
  548.         EndM
  549.     ELSE
  550.         IMPORT_CFM_FUNCTION SndSoundManagerVersion
  551.     ENDIF
  552.  
  553. ;
  554. ; pascal OSErr SndStartFilePlay(SndChannelPtr chan, short fRefNum, short resNum, long bufferSize, void *theBuffer, AudioSelectionPtr theSelection, FilePlayCompletionUPP theCompletion, Boolean async)
  555. ;
  556.     IF ¨ GENERATINGCFM THEN
  557.         Macro
  558.         _SndStartFilePlay
  559.             move.l              #$0D000008,D0
  560.             dc.w                $A800
  561.         EndM
  562.     ELSE
  563.         IMPORT_CFM_FUNCTION SndStartFilePlay
  564.     ENDIF
  565.  
  566. ;
  567. ; pascal OSErr SndPauseFilePlay(SndChannelPtr chan)
  568. ;
  569.     IF ¨ GENERATINGCFM THEN
  570.         Macro
  571.         _SndPauseFilePlay
  572.             move.l              #$02040008,D0
  573.             dc.w                $A800
  574.         EndM
  575.     ELSE
  576.         IMPORT_CFM_FUNCTION SndPauseFilePlay
  577.     ENDIF
  578.  
  579. ;
  580. ; pascal OSErr SndStopFilePlay(SndChannelPtr chan, Boolean quietNow)
  581. ;
  582.     IF ¨ GENERATINGCFM THEN
  583.         Macro
  584.         _SndStopFilePlay
  585.             move.l              #$03080008,D0
  586.             dc.w                $A800
  587.         EndM
  588.     ELSE
  589.         IMPORT_CFM_FUNCTION SndStopFilePlay
  590.     ENDIF
  591.  
  592. ;
  593. ; pascal OSErr SndChannelStatus(SndChannelPtr chan, short theLength, SCStatusPtr theStatus)
  594. ;
  595.     IF ¨ GENERATINGCFM THEN
  596.         Macro
  597.         _SndChannelStatus
  598.             move.l              #$05100008,D0
  599.             dc.w                $A800
  600.         EndM
  601.     ELSE
  602.         IMPORT_CFM_FUNCTION SndChannelStatus
  603.     ENDIF
  604.  
  605. ;
  606. ; pascal OSErr SndManagerStatus(short theLength, SMStatusPtr theStatus)
  607. ;
  608.     IF ¨ GENERATINGCFM THEN
  609.         Macro
  610.         _SndManagerStatus
  611.             move.l              #$03140008,D0
  612.             dc.w                $A800
  613.         EndM
  614.     ELSE
  615.         IMPORT_CFM_FUNCTION SndManagerStatus
  616.     ENDIF
  617.  
  618. ;
  619. ; pascal void SndGetSysBeepState(short *sysBeepState)
  620. ;
  621.     IF ¨ GENERATINGCFM THEN
  622.         Macro
  623.         _SndGetSysBeepState
  624.             move.l              #$02180008,D0
  625.             dc.w                $A800
  626.         EndM
  627.     ELSE
  628.         IMPORT_CFM_FUNCTION SndGetSysBeepState
  629.     ENDIF
  630.  
  631. ;
  632. ; pascal OSErr SndSetSysBeepState(short sysBeepState)
  633. ;
  634.     IF ¨ GENERATINGCFM THEN
  635.         Macro
  636.         _SndSetSysBeepState
  637.             move.l              #$011C0008,D0
  638.             dc.w                $A800
  639.         EndM
  640.     ELSE
  641.         IMPORT_CFM_FUNCTION SndSetSysBeepState
  642.     ENDIF
  643.  
  644. ;
  645. ; pascal OSErr SndPlayDoubleBuffer(SndChannelPtr chan, SndDoubleBufferHeaderPtr theParams)
  646. ;
  647.     IF ¨ GENERATINGCFM THEN
  648.         Macro
  649.         _SndPlayDoubleBuffer
  650.             move.l              #$04200008,D0
  651.             dc.w                $A800
  652.         EndM
  653.     ELSE
  654.         IMPORT_CFM_FUNCTION SndPlayDoubleBuffer
  655.     ENDIF
  656.  
  657. ;  MACE compression routines 
  658. ;
  659. ; pascal NumVersion MACEVersion(void )
  660. ;
  661.     IF ¨ GENERATINGCFM THEN
  662.         Macro
  663.         _MACEVersion
  664.             move.l              #$00000010,D0
  665.             dc.w                $A800
  666.         EndM
  667.     ELSE
  668.         IMPORT_CFM_FUNCTION MACEVersion
  669.     ENDIF
  670.  
  671. ;
  672. ; pascal void Comp3to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  673. ;
  674.     IF ¨ GENERATINGCFM THEN
  675.         Macro
  676.         _Comp3to1
  677.             move.l              #$00040010,D0
  678.             dc.w                $A800
  679.         EndM
  680.     ELSE
  681.         IMPORT_CFM_FUNCTION Comp3to1
  682.     ENDIF
  683.  
  684. ;
  685. ; pascal void Exp1to3(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  686. ;
  687.     IF ¨ GENERATINGCFM THEN
  688.         Macro
  689.         _Exp1to3
  690.             move.l              #$00080010,D0
  691.             dc.w                $A800
  692.         EndM
  693.     ELSE
  694.         IMPORT_CFM_FUNCTION Exp1to3
  695.     ENDIF
  696.  
  697. ;
  698. ; pascal void Comp6to1(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  699. ;
  700.     IF ¨ GENERATINGCFM THEN
  701.         Macro
  702.         _Comp6to1
  703.             move.l              #$000C0010,D0
  704.             dc.w                $A800
  705.         EndM
  706.     ELSE
  707.         IMPORT_CFM_FUNCTION Comp6to1
  708.     ENDIF
  709.  
  710. ;
  711. ; pascal void Exp1to6(const void *inBuffer, void *outBuffer, unsigned long cnt, StateBlockPtr inState, StateBlockPtr outState, unsigned long numChannels, unsigned long whichChannel)
  712. ;
  713.     IF ¨ GENERATINGCFM THEN
  714.         Macro
  715.         _Exp1to6
  716.             move.l              #$00100010,D0
  717.             dc.w                $A800
  718.         EndM
  719.     ELSE
  720.         IMPORT_CFM_FUNCTION Exp1to6
  721.     ENDIF
  722.  
  723. ;  Sound Manager 3.0 and later calls 
  724. ;
  725. ; pascal OSErr GetSysBeepVolume(long *level)
  726. ;
  727.     IF ¨ GENERATINGCFM THEN
  728.         Macro
  729.         _GetSysBeepVolume
  730.             move.l              #$02240018,D0
  731.             dc.w                $A800
  732.         EndM
  733.     ELSE
  734.         IMPORT_CFM_FUNCTION GetSysBeepVolume
  735.     ENDIF
  736.  
  737. ;
  738. ; pascal OSErr SetSysBeepVolume(long level)
  739. ;
  740.     IF ¨ GENERATINGCFM THEN
  741.         Macro
  742.         _SetSysBeepVolume
  743.             move.l              #$02280018,D0
  744.             dc.w                $A800
  745.         EndM
  746.     ELSE
  747.         IMPORT_CFM_FUNCTION SetSysBeepVolume
  748.     ENDIF
  749.  
  750. ;
  751. ; pascal OSErr GetDefaultOutputVolume(long *level)
  752. ;
  753.     IF ¨ GENERATINGCFM THEN
  754.         Macro
  755.         _GetDefaultOutputVolume
  756.             move.l              #$022C0018,D0
  757.             dc.w                $A800
  758.         EndM
  759.     ELSE
  760.         IMPORT_CFM_FUNCTION GetDefaultOutputVolume
  761.     ENDIF
  762.  
  763. ;
  764. ; pascal OSErr SetDefaultOutputVolume(long level)
  765. ;
  766.     IF ¨ GENERATINGCFM THEN
  767.         Macro
  768.         _SetDefaultOutputVolume
  769.             move.l              #$02300018,D0
  770.             dc.w                $A800
  771.         EndM
  772.     ELSE
  773.         IMPORT_CFM_FUNCTION SetDefaultOutputVolume
  774.     ENDIF
  775.  
  776. ;
  777. ; pascal OSErr GetSoundHeaderOffset(SndListHandle sndHandle, long *offset)
  778. ;
  779.     IF ¨ GENERATINGCFM THEN
  780.         Macro
  781.         _GetSoundHeaderOffset
  782.             move.l              #$04040018,D0
  783.             dc.w                $A800
  784.         EndM
  785.     ELSE
  786.         IMPORT_CFM_FUNCTION GetSoundHeaderOffset
  787.     ENDIF
  788.  
  789. ;
  790. ; pascal UnsignedFixed UnsignedFixedMulDiv(UnsignedFixed value, UnsignedFixed multiplier, UnsignedFixed divisor)
  791. ;
  792.     IF ¨ GENERATINGCFM THEN
  793.         Macro
  794.         _UnsignedFixedMulDiv
  795.             move.l              #$060C0018,D0
  796.             dc.w                $A800
  797.         EndM
  798.     ELSE
  799.         IMPORT_CFM_FUNCTION UnsignedFixedMulDiv
  800.     ENDIF
  801.  
  802. ;
  803. ; pascal OSErr GetCompressionInfo(short compressionID, OSType format, short numChannels, short sampleSize, CompressionInfoPtr cp)
  804. ;
  805.     IF ¨ GENERATINGCFM THEN
  806.         Macro
  807.         _GetCompressionInfo
  808.             move.l              #$07100018,D0
  809.             dc.w                $A800
  810.         EndM
  811.     ELSE
  812.         IMPORT_CFM_FUNCTION GetCompressionInfo
  813.     ENDIF
  814.  
  815. ;
  816. ; pascal OSErr SetSoundPreference(OSType theType, Str255 name, Handle settings)
  817. ;
  818.     IF ¨ GENERATINGCFM THEN
  819.         Macro
  820.         _SetSoundPreference
  821.             move.l              #$06340018,D0
  822.             dc.w                $A800
  823.         EndM
  824.     ELSE
  825.         IMPORT_CFM_FUNCTION SetSoundPreference
  826.     ENDIF
  827.  
  828. ;
  829. ; pascal OSErr GetSoundPreference(OSType theType, Str255 name, Handle settings)
  830. ;
  831.     IF ¨ GENERATINGCFM THEN
  832.         Macro
  833.         _GetSoundPreference
  834.             move.l              #$06380018,D0
  835.             dc.w                $A800
  836.         EndM
  837.     ELSE
  838.         IMPORT_CFM_FUNCTION GetSoundPreference
  839.     ENDIF
  840.  
  841. ;  Sound Manager 3.1 and later calls 
  842. ;
  843. ; pascal OSErr SndGetInfo(SndChannelPtr chan, OSType selector, void *infoPtr)
  844. ;
  845.     IF ¨ GENERATINGCFM THEN
  846.         Macro
  847.         _SndGetInfo
  848.             move.l              #$063C0018,D0
  849.             dc.w                $A800
  850.         EndM
  851.     ELSE
  852.         IMPORT_CFM_FUNCTION SndGetInfo
  853.     ENDIF
  854.  
  855. ;
  856. ; pascal OSErr SndSetInfo(SndChannelPtr chan, OSType selector, const void *infoPtr)
  857. ;
  858.     IF ¨ GENERATINGCFM THEN
  859.         Macro
  860.         _SndSetInfo
  861.             move.l              #$06400018,D0
  862.             dc.w                $A800
  863.         EndM
  864.     ELSE
  865.         IMPORT_CFM_FUNCTION SndSetInfo
  866.     ENDIF
  867.  
  868. ;
  869. ; pascal OSErr GetSoundOutputInfo(Component outputDevice, OSType selector, void *infoPtr)
  870. ;
  871.     IF ¨ GENERATINGCFM THEN
  872.         Macro
  873.         _GetSoundOutputInfo
  874.             move.l              #$06440018,D0
  875.             dc.w                $A800
  876.         EndM
  877.     ELSE
  878.         IMPORT_CFM_FUNCTION GetSoundOutputInfo
  879.     ENDIF
  880.  
  881. ;
  882. ; pascal OSErr SetSoundOutputInfo(Component outputDevice, OSType selector, const void *infoPtr)
  883. ;
  884.     IF ¨ GENERATINGCFM THEN
  885.         Macro
  886.         _SetSoundOutputInfo
  887.             move.l              #$06480018,D0
  888.             dc.w                $A800
  889.         EndM
  890.     ELSE
  891.         IMPORT_CFM_FUNCTION SetSoundOutputInfo
  892.     ENDIF
  893.  
  894. ;  Sound Manager 3.2 and later calls 
  895. ;
  896. ; pascal OSErr GetCompressionName(OSType compressionType, Str255 compressionName)
  897. ;
  898.     IF ¨ GENERATINGCFM THEN
  899.         Macro
  900.         _GetCompressionName
  901.             move.l              #$044C0018,D0
  902.             dc.w                $A800
  903.         EndM
  904.     ELSE
  905.         IMPORT_CFM_FUNCTION GetCompressionName
  906.     ENDIF
  907.  
  908. ;
  909. ; pascal OSErr SoundConverterOpen(const SoundComponentData *inputFormat, const SoundComponentData *outputFormat, SoundConverter *sc)
  910. ;
  911.     IF ¨ GENERATINGCFM THEN
  912.         Macro
  913.         _SoundConverterOpen
  914.             move.l              #$06500018,D0
  915.             dc.w                $A800
  916.         EndM
  917.     ELSE
  918.         IMPORT_CFM_FUNCTION SoundConverterOpen
  919.     ENDIF
  920.  
  921. ;
  922. ; pascal OSErr SoundConverterClose(SoundConverter sc)
  923. ;
  924.     IF ¨ GENERATINGCFM THEN
  925.         Macro
  926.         _SoundConverterClose
  927.             move.l              #$02540018,D0
  928.             dc.w                $A800
  929.         EndM
  930.     ELSE
  931.         IMPORT_CFM_FUNCTION SoundConverterClose
  932.     ENDIF
  933.  
  934. ;
  935. ; pascal OSErr SoundConverterGetBufferSizes(SoundConverter sc, unsigned long inputBytesTarget, unsigned long *inputFrames, unsigned long *inputBytes, unsigned long *outputBytes)
  936. ;
  937.     IF ¨ GENERATINGCFM THEN
  938.         Macro
  939.         _SoundConverterGetBufferSizes
  940.             move.l              #$0A580018,D0
  941.             dc.w                $A800
  942.         EndM
  943.     ELSE
  944.         IMPORT_CFM_FUNCTION SoundConverterGetBufferSizes
  945.     ENDIF
  946.  
  947. ;
  948. ; pascal OSErr SoundConverterBeginConversion(SoundConverter sc)
  949. ;
  950.     IF ¨ GENERATINGCFM THEN
  951.         Macro
  952.         _SoundConverterBeginConversion
  953.             move.l              #$025C0018,D0
  954.             dc.w                $A800
  955.         EndM
  956.     ELSE
  957.         IMPORT_CFM_FUNCTION SoundConverterBeginConversion
  958.     ENDIF
  959.  
  960. ;
  961. ; pascal OSErr SoundConverterConvertBuffer(SoundConverter sc, const void *inputPtr, unsigned long inputFrames, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes)
  962. ;
  963.     IF ¨ GENERATINGCFM THEN
  964.         Macro
  965.         _SoundConverterConvertBuffer
  966.             move.l              #$0C600018,D0
  967.             dc.w                $A800
  968.         EndM
  969.     ELSE
  970.         IMPORT_CFM_FUNCTION SoundConverterConvertBuffer
  971.     ENDIF
  972.  
  973. ;
  974. ; pascal OSErr SoundConverterEndConversion(SoundConverter sc, void *outputPtr, unsigned long *outputFrames, unsigned long *outputBytes)
  975. ;
  976.     IF ¨ GENERATINGCFM THEN
  977.         Macro
  978.         _SoundConverterEndConversion
  979.             move.l              #$08640018,D0
  980.             dc.w                $A800
  981.         EndM
  982.     ELSE
  983.         IMPORT_CFM_FUNCTION SoundConverterEndConversion
  984.     ENDIF
  985.  
  986.     ENDIF
  987.     ENDIF ; __SOUND__ 
  988.  
  989.